import 'package:fab_circular_menu/fab_circular_menu.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {

  final GlobalKey<FabCircularMenuState> fabKey = GlobalKey();

  @override
  Widget build(BuildContext context) {
    final primaryColor = Theme.of(context).primaryColor;

    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Container(
          color: const Color(0xFF192A56),
          child: Center(
            child: RaisedButton(
              onPressed: () {
                // The menu can be handled programatically using a key
                if (fabKey.currentState.isOpen) {
                  fabKey.currentState.close();
                } else {
                  fabKey.currentState.open();
                }
              },
              color: Colors.white,
              child: Text('Toggle menu programatically', style: TextStyle(color: primaryColor)),
            ),
          ),
        ),
        floatingActionButton: Builder(
          builder: (context) => FabCircularMenu(
            key: fabKey,
            // Cannot be `Alignment.center`
            alignment: Alignment.center,
            ringColor: Colors.white.withAlpha(25),
            ringDiameter: MediaQuery.of(context).size.width,
            ringWidth: 200.0,
            fabSize: 44.0,
            fabElevation: 8.0,
            fabIconBorder: StadiumBorder(),
            // Also can use specific color based on wether
            // the menu is open or not:
            // fabOpenColor: Colors.white
            // fabCloseColor: Colors.white
            // These properties take precedence over fabColor
            fabColor: Colors.white,
            fabOpenIcon: Icon(Icons.menu, color: primaryColor),
            fabCloseIcon: Icon(Icons.close, color: primaryColor),
            fabMargin: const EdgeInsets.all(6.0),
            animationDuration: const Duration(milliseconds: 800),
            animationCurve: Curves.easeInOutCirc,
            onDisplayChange: (isOpen) {
              // _showSnackBar(context, "The menu is ${isOpen ? "open" : "closed"}");
            },
            children: <Widget>[
                                Positioned(
                                  bottom: 224,
                                  right: 30,
                                  child: Container(
                                    height: 44,
                                    child: Row(
                                      children: [
                                        Text(
                                          '发布活动',
                                          style: TextStyle(
                                            fontSize: 14,
                                            color: Colors.white
                                          ),
                                        ),
                                        SizedBox(
                                          width: 20,
                                        ),
                                        Container(
                                          width: 44,
                                          height: 44,
                                          child: RawMaterialButton(
                                            onPressed: () {
                                              
                                            },
                                            child: Center(
                                              child: Icon(Icons.menu,),
                                            )
                                          )
                                        )
                                      ],
                                    )
                                  )
                                ),
                                Positioned(
                                  bottom: 298,
                                  right: 30,
                                  child: Container(
                                    height: 44,
                                    child: Row(
                                      children: [
                                        Text(
                                          '发布动态',
                                          style: TextStyle(
                                            fontSize: 14,
                                            color: Colors.white
                                          ),
                                        ),
                                        SizedBox(
                                          width: 20,
                                        ),
                                        Container(
                                          width: 44,
                                          height: 44,
                                          child: RawMaterialButton(
                                            onPressed: () {
                                              
                                            },
                                            child: Center(
                                              child: Icon(Icons.menu,),
                                            )
                                          )
                                        )
                                      ],
                                    )
                                  )
                                ),
                              ] ,
          ),
        ),
      ),
    );
  }

  void _showSnackBar(BuildContext context, String message) {
    Scaffold.of(context).showSnackBar(
        SnackBar(
      content: Text(message),
      duration: const Duration(milliseconds: 1000),
        )
    );
  }

}
